package com.zzj.controller;

import com.github.pagehelper.PageInfo;
import com.zzj.bean.ShapeBean;
import com.zzj.service.ShapeService;
import com.zzj.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//@CrossOrigin
@Api
@RestController
@RequestMapping("shape")
public class ShapeController {
    @Autowired
    private ShapeService shapeService;

    @GetMapping("findAll")
    @ApiOperation("查询打型表")
    public PageInfo<ShapeBean> findAll(
            @RequestParam(defaultValue = "1") int pageNum,
            @RequestParam(defaultValue = "5") int pageSize
    ){
        return shapeService.findAll(pageNum,pageSize);
    }

    @PostMapping("updateShape")
    @ApiOperation("提交打型表")
    public Result updateShape(@RequestBody ShapeBean shapeBean){
        System.out.println("shapeBean = " + shapeBean);
        return shapeService.updateShape(shapeBean);
    }
}
